
#include <decls.hpp>
#include <exceptions.hpp>
#include <natives.h>
#include <notifier.hpp>

JNIEXPORT void JNICALL METADATA3(Map, Put) (JNIEnv *env, jclass clazz, jlong handle, jlong pair_handle)
{
    CUBEFS_EXC_BEGIN

    Map* iter = Handle2Ptr<Map>(handle);
    Map::Pair* pair = Handle2Ptr<Map::Pair>(pair_handle);

    iter->Put(pair);

    CUBEFS_EXC_HANDLE
}

JNIEXPORT jboolean JNICALL METADATA3(Map, Get) (JNIEnv *env, jclass clazz, jlong handle, jlong pair_handle)
{
    CUBEFS_EXC_BEGIN

    Map* iter = Handle2Ptr<Map>(handle);
    Map::Pair* pair = Handle2Ptr<Map::Pair>(pair_handle);

    return iter->Get(pair);

    CUBEFS_EXC_HANDLE
    return 0;
}

JNIEXPORT jboolean JNICALL METADATA3(Map, Remove) (JNIEnv *env, jclass clazz, jlong handle, jlong pair_handle)
{
    CUBEFS_EXC_BEGIN

    Map* iter = Handle2Ptr<Map>(handle);
    Map::Pair* pair = Handle2Ptr<Map::Pair>(pair_handle);

    return iter->Remove(pair);

    CUBEFS_EXC_HANDLE
    return 0;
}